<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="css/index.css">
    <link rel="stylesheet" href="css/layui/css/layui.css">
    <title>接口管理</title>
</head>
<script src="js/jquery-2.2.3.min.js"></script>
<script src="js/index.js"></script>
<script src="js/laytpl.js"></script>
<script src="js/layer.js"></script>
<style type="text/css">
    .layui-form {
        top:auto;
    }
</style>
<body>
    <div class="layui-header top">
        <h2>接口管理</h2>
    </div>
    <div class="layui-main">
        <div class="layui-form" action="">
            <div class="search layui-form-item">
                <div class="search_list">
                    <label class="layui-form-label">接口名称</label>
                    <div class="layui-input-inline">
                        <input class="layui-input" id="CMD" type="text">
                    </div>
                </div>
                <div class="search_list">
                    <label class="layui-form-label">说明</label>
                    <div class="layui-input-inline">
                        <input class="layui-input" id="TEXT" type="text">
                    </div>

                </div>
                <div class="search_btn">
                    <button class="layui-btn" onclick="insertcmd()">
                        <i class="layui-icon">&#xe608;</i> 添加</button>
                </div>
                <div class="search_btn">
                    <button class="layui-btn" onclick="searchcmd()">
                        <i class="layui-icon">&#xe615;</i> 搜索</button>
                    </button>
                </div>
            </div>
        </div>
        <table class="layui-table">
            <thead>
                <tr>
                    <th width='15%'>接口名称</th>
                    <th width='35%'>接口SQL</th>
                    <th width='20%'>接口备注</th>
                    <th width='20%'>操作</th>
                </tr>
            </thead>
            <tbody id="table_view">

            </tbody>
        </table>

    </div>
    <div class="bottom"></div>
    <script type="text/html" id="table_tpl">
        <tr>
         <td>{{d.CMD}}</td>
                <td>{{d.SQL}}</td>
                <td>{{d.TEXT}}</td>
                <td>
                    <span>
                        <button class="layui-btn layui-btn-normal" onclick="update_cmd({{d.ID}})">编辑</button>
                    </span>
                    <span>
                        <button  class="layui-btn layui-btn-warm" onclick="show_cmd({{d.ID}})">查看</button>
                    </span>
                    <span>
                        <button  class="layui-btn layui-btn-danger" onclick="delete_cmd({{d.ID}})">删除</button>
                    </span>
                </td>
            </tr>
    </script>
    <script type="text/html" id="model">
        <form class="layui-form" action="">
                <div class="layui-form-item">
                        <label class="layui-form-label">接口名字</label>
                        <div class="layui-input-block">
                          <input type="text"  name="title" id="cmd_cmd" required  lay-verify="required" placeholder="输入接口名称" autocomplete="off" class="layui-input">
                        </div>
                </div>
                <div class="layui-form-item">
                        <label class="layui-form-label">接口说明</label>
                        <div class="layui-input-block">
                          <input type="text" name="title"  id="cmd_text" required  lay-verify="required" placeholder="输入接口说明" autocomplete="off" class="layui-input">
                        </div>
                </div>
                <div class="layui-form-item">
                        <label class="layui-form-label">接口SQL</label>
                        <div class="layui-input-block">
                                <textarea name="desc" id="cmd_sql" placeholder="请输入SQL语句" class="layui-textarea"></textarea>
                        </div>
                </div>
        </form>
    </script>
</body>
<script>
    init();
</script>

</html>